package com.xingshang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xingshang.model.po.OrderItem;
import com.xingshang.service.OrderItemService;
import com.xingshang.mapper.OrderItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 87547
* @description 针对表【wn_order_item】的数据库操作Service实现
* @createDate 2025-05-17 23:06:33
*/
@Service
public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem>
    implements OrderItemService{

        // 批量插入订单项

    @Autowired
    private OrderItemMapper orderItemMapper;

    @Override
    public int batchInsert(List<OrderItem> items)
    {
        return orderItemMapper.batchInsert(items);
    }

    @Override
    public List<OrderItem> findByOrderId(int orderId) {
        QueryWrapper<OrderItem> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_id", orderId);
        return this.list(queryWrapper);
    }



}




